<%@ page import="pc.system.*,wstrader.*,wstrader.task.*" %>
<%
    Users user = Trader.getUser(request.getParameter("uid"));
	if (!user.Authenticated()) {
		response.sendRedirect("logon.jsp");
		return;
	}	

	//Home task = user.home;
Tasks task = (Tasks)user;
	//task.clearFocus();
	//task.setFocus(true);
%>

<%@include file="../header.jsp"%>

<script language="javascript">
function doChange()
{
	if (getValue("old_password") == "") {
		alert("Invalid password");
		getObj("old_password").focus();
		return false;
	}
	if (getValue("new_password") == "") {
		alert("New password can not be empty");
		getObj("new_password").focus();
		return false;
	}
	if (getValue("new_password") != getValue("re_password")) {
		alert("Retype password not correct");
		getObj("new_password").focus();
		return false;
	}
	doTask(1);
}

function keyUp()
{
	if (window.event.keyCode == 13) {
    	return doChange() ;
	}
    return true;
}

</script>
<style type="text/css">
<!--
.style1 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-style: normal;
	font-weight: normal;
	font-variant: normal;
}
-->
</style>


<form name="formMain" method="post" action="" onSubmit="" >
<table width="100%" border="0" cellspacing="0" cellpadding="0">

<table width="100%" border="0" cellspacing="0" cellpadding="0" background="">
  <tr>
  	<td width="30%">&nbsp;</td>
    <td width="70%" height="360" align="center" valign="center" background=""><table width="100%" border="0" cellspacing="0" cellpadding="0" class="style1">
                      <tr>
                        <td colspan="2"><strong>Welcome <%=user.getFullName()%> to Wernersoft</strong></td>
                      </tr>
                      <tr>
                        <td colspan="2" height="12">&nbsp;</td>
                      </tr>
                      <tr> 
                        <td width="180">Current password *</td>
                        <td width="534"><input type="password" name="old_password" id="old_password" autocomplete="off" style="font-family:Arial; font-size:12; width:120;">
						<script language="JavaScript">
							document.formMain.old_password.focus();
						</script>
						</td>
                      </tr>
                      <tr> 
                        <td>New password *</td>
                        <td><input type="password" name="new_password" id="new_password" autocomplete="off" style="font-family:Arial; font-size:12; width:120;"></td>
                      </tr>
					  <tr> 
                        <td>Confirm new password *</td>
                        <td><input type="password" name="re_password" id="re_password" autocomplete="off" onKeyPress="javascript:keyUp();" style="font-family:Arial; font-size:12; width:120;"></td>
                      </tr>
					  <tr>
					    <td>&nbsp;</td>
					    <td><img src="images/update.gif" width="15" height="15" onClick="doChange()" alt="Ok">&nbsp;<img src="images/delete.gif" width="15" height="15" onClick="javascript: doFilter('home.jsp')" alt="Cancel"></td>
	      </tr>
                    </table></td>
  </tr>
</table>

	<input type="hidden" name="uid"       id = "uid"      value="<%=user.getuid()%>">
    <input type="hidden" name="task_id"    id = "update"   value="0">
    <input type="hidden" name="linkPage"  id = "linkPage" value="home.jsp">
</form>

<%@include file="../footer.jsp"%>

<%
	if (user.getRequest().getIntValue("task_id") == 1 && user.changePwd()) {
		task.getResponse().forwardTo(user.getuid(),"home.jsp");
	}
%>

